题 目:Tween类:图片缓动浏览效果
图片缓动浏览效果,用Tween类做的一个图片浏览效果。
import mx.transitions.Tween;
//定义成函数,方便调用
// 如果你还不是很清楚Tween类,请查看FLASH帮助文档-->组件语言参考-->Tween类
//可更改缓动函数做出更多的效果
function mcTween(mcID, WEnd,HEnd) {
var myTween:Tween = new Tween(eval(mcID), "_width", mx.transitions.easing.Back.easeOut, eval(mcID)._width, WEnd, 1, true);
var myTween:Tween = new Tween(eval(mcID), "_height", mx.transitions.easing.Back.easeOut, eval(mcID)._height, HEnd, 1, true);
}
// 按钮事件 这里写的比较烦锁 回头用数组试试 代码精练一下
mc.onPress=function(){
//注意 下面调用前的函数
mcTween(mc,250,300);
startDrag("mc");
//改变深度至Front
mx.behaviors.DepthControl.bringToFront(this);
}
mc.onRelease=function(){
mcTween(mc,125,150);
stopDrag();
}
mc2.onPress=function(){
mcTween(mc2,250,300);
startDrag("mc2");
mx.behaviors.DepthControl.bringToFront(this);
}
mc2.onRelease=mc2.onRollOut=function(){
mcTween(mc2,125,150);
stopDrag();
}
mc3.onPress=function(){
mcTween(mc3,250,300);
startDrag("mc3");
mx.behaviors.DepthControl.bringToFront(this);
}
mc3.onRelease=mc3.onRollOut=function(){
mcTween(mc3,125,150);
stopDrag();
}
|